package moder

import "gorm.io/gorm"

type Goods struct {
	gorm.Model
	Title   string `gorm:"type:varchar(100)"`
	Price   int64  `gorm:"type:int(10)"`
	ClassId int64  `gorm:"type:int(10)"`
}

func (g *Goods) GoodsAdd(db *gorm.DB) error {
	return db.Create(g).Error
}

func (g *Goods) GoodsShow(db *gorm.DB, id int64) error {
	return db.Where("id=?", id).First(g).Error
}

type Class struct {
	gorm.Model
	Name string `gorm:"type:varchar(100)"`
}
